package com.runa.monitor.platinterface.extend.nb.controller;

import com.alibaba.fastjson.JSONObject;
import com.runa.monitor.platinterface.extend.nb.service.NbPlantService;
import com.runa.monitor.platinterface.extend.nb.service.TaiYuanNbPlantService;
import com.runa.monitor.platinterface.extend.nb.vo.ReportDataBaseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("comm")
@Slf4j
public class TaiYuanNbController {

    @Resource
    private TaiYuanNbPlantService taiYuanNbPlantService;

//    /**
//     * 楼阀数据接入
//     *
//     * @param body
//     * @return
//     * @throws Exception
//     */
//    @PostMapping("receiveAEP_TaiYuanValve")
//    public String receiveAEP_TaiYuanValve(@RequestBody String body) throws Exception {
//        ReportDataBaseVo baseVo = JSONObject.parseObject(body, ReportDataBaseVo.class);
//        log.info("---收到租户id：" + baseVo.getTenantId() + ",NB-IoT receiveAEP_TaiYuanValve 设备上报的数据：" + body);
//        JSONObject jsonObject = JSONObject.parseObject(body);
//        String messageType = jsonObject.getString("messageType");
//        String tenantId = jsonObject.getString("tenantId");
//        if ("dataReport".equals(messageType)) {
//            if (mqttNbIotConfig.getTenantId().equals(tenantId)) {
//                executor.execute(() -> taiYuanNbPlantService.receiveAEP_Valve(baseVo));
//            }
//        }
//        return "ok";
//    }
}
